<?php

if (!function_exists ('setClientHeader')) {
    function setClientHeader ($service, $token = '')
    {
        $service->setHeader ('X-USER-TOKEN', $token);
        $service->setHeader ('X-REQUEST-TIME', time ());
    }
}


if (!function_exists('route_parameter')) {
    /**
     * Get a given parameter from the route.
     *
     * @param $name
     * @param null $default
     * @return mixed
     */
    function route_parameter($name, $default = null)
    {
        $routeInfo = app('request')->all();
        return isset($routeInfo[$name]) && $routeInfo[$name] ? $routeInfo[$name] : $default;
    }
}